package com.kwedding.service.app;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kwedding.bean.TB_Style;
import com.kwedding.dao.TB_StyleMapper;
import com.kwedding.dto.app.RequestStyleSimple;
import com.kwedding.dto.app.ResponseStyleSimple;
import com.kwedding.util.CheckedUtil;
import com.kwedding.util.Constants;
import com.kwedding.util.CopyerObject;
import com.kwedding.util.LoggerParent;

@Service
public class StyleService extends LoggerParent {
	@Autowired
	private TB_StyleMapper tb_StyleMapper;

	/**
	 * 获取风格列表
	 * 
	 * @param requestStyleSimple
	 * @return
	 */
	@Transactional(readOnly = true)
	public List<ResponseStyleSimple> getBrandStyle(RequestStyleSimple requestStyleSimple) {
		CheckedUtil.isNull(requestStyleSimple.getBrandId(), Constants.REQUEST_ERROR_1, "品牌不能为空");
		List<TB_Style> tb_Styles = tb_StyleMapper.getStyleList(requestStyleSimple.getBrandId(), false);
		List<ResponseStyleSimple> responseStyleSimples = new ArrayList<>();
		if (tb_Styles != null && tb_Styles.size() > 0) {
			responseStyleSimples = CopyerObject.copyerListObject(tb_Styles, ResponseStyleSimple.class);
		}
		return responseStyleSimples;
	}
}
